#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Project  : untitled1
# @File     : page_tencent_news_search.py
# @Author   : liujie
# @Time     : 2021/07/07 23:55
from selenium.webdriver.common.by import By

class PageTencentNewsComment():
    def __init__(self, driver):
        self.driver = driver
        # 定位器
        self.loc_ele_search_box = (By.XPATH, '//android.widget.FrameLayout[@resource-id="com.tencent.news:id/aqs"]')  # 定位搜索框
        self.loc_ele_search = (By.XPATH, '//android.widget.EditText[@resource-id="com.tencent.news:id/cdw"]')  # 定位搜索按钮

    def ele_search_box(self):
        self.driver.find_element(*self.loc_ele_search_box).click()

    def ele_search(self):
        self.driver.find_element(*self.loc_ele_search).click()

    def ele_enter(self, word):
        self.driver.press_keycode(word)

        # 所有方法的集合
    def search(self, word):
        self.ele_search_box()
        self.ele_search()
        self.ele_enter(word)
